<?php
// 保存到数据库
date_default_timezone_set("PRC");

$dsn = "mysql:host=127.0.0.1;dbname=blog";
$db = new PDO($dsn, "root", "123456");
$db->exec("set names utf8mb4");

$updateTime = time();

$sql = "update admin set admin_name='$adminName',";
if ($adminPassword && $adminPassword2) {
    $salt = "0w37qVYCCu#SV7s4x3ctMNwQS@&4Hc";
    $adminPassword = md5($salt. md5($salt . $adminPassword . $salt) . $salt);

    $sql .= " admin_password='$adminPassword', ";
}
$sql .= " update_time='$updateTime' 
              where admin_id='$adminId'";
$result = $db->exec($sql);
//var_dump($db->errorInfo());